//#include "StdAfx.h"
#include "HPErrorLog.h"
#include "HPAscySocket.h"
#include "HPPer_socket.h"
#include "HPPool.h"
#include "HPPer_IO.h"
#include "HPErrorHandling.h"

HPErrorHandling::HPErrorHandling(void)
{
	pTempAscySocket = new HPAscySocket;
	pTempErrorlog = new HPErrorLog;
	pTempPool = new HPPool;
}

HPErrorHandling::~HPErrorHandling(void)
{
}


void HPErrorHandling::ErrorHandlingAndLogging(int ErrorNumber, void *perIO)
{
	
	switch(ErrorNumber)
	{
	case 10014:								 
	case 10053:
	case 10060:
		perIO=pTempPool->outPool();
		pTempAscySocket-> disconnectSocket((HPPer_IO*)perIO);
		break;
	case 10004:
		Sleep(30);
		break;
	case 10013:
	case 10022:
	case 10024:
	case 10035:
	case 10036:		
	case 10037:
	case 10038:		
	case 10039: 		 		
	case 10040:
	case 10044:
	case 10045:				
	case 10051:
	case 10052:
	case 10054:
	case 10055:
	case 10056:
	case 10057:
	case 10061:
	case 10062:
	case 10063:
	case 10064:
	case 10065:
	case 10066:
	case 10067:
	case 10068:
	case 10069:
	case 10070:
	case 10071:
	case 10091:
	case 10092:
	case 10102:
	case 10103:
	case 10104:
		pTempErrorlog->OutToLogByErrorCode(ErrorNumber);
		break;
	case 10093:
		pTempAscySocket->socketServerStart();
		break;
	case 10058:
	case 10101:
		pTempPool->inPool(perIO);
		break;

	}	

}

